﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WP09S03_OfficeTracking.ParentClass
{
    public partial class ParentDiag : Form
    {
        public ParentDiag()
        {
            InitializeComponent();
        }

        protected bool IsShowMessageBox = false;

        public void SetMessage(String strMessage)
        {
            lblMessage.Text = strMessage;
            timer1.Enabled = true;
        }

        public void SetSubtitle(String strTitle)
        {
            lblSubTitle.Text = strTitle;
        }

        private void ParentDiag_Load(object sender, EventArgs e)
        {
           // SetMessage("");
            lblMessage.Text = "";
        }


        protected void CatchError(Exception ex)
        {
            SetMessage(ex.Message);
            if (IsShowMessageBox) {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
           
        }

        protected DialogResult ShowDeleteConfirm()
        {
            return MessageBox.Show("Are you sure to delete this record?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            lblMessage.Text = "";
            timer1.Enabled = false;
        }
    }
}
